package edu.zut.cs.network.Experiment5;

import java.util.Random;

import org.apache.log4j.*;
public class PrintTimes {
    private static Logger logger = Logger.getLogger(PrintTimes.class);
    public static void main(String[] args) {
//        	写程序产生一百个在0和9之间的随机整数，然后统计并输出每个整数出现的次数
        Random ranNum = new Random();
        int [] ar = new int [10];
        for(int i = 0; i < 10;i++){
            ar[i] = 0;
        }
        for (int i = 0; i < 100; i++){
            int num = ranNum.nextInt(10);
            switch (num){
                case 0:
                    ar[0]++;break;
                case 1:
                    ar[1]++;break;
                case 2:
                    ar[2]++;break;
                case 3:
                    ar[3]++;break;
                case 4:
                    ar[4]++;break;
                case 5:
                    ar[5]++;break;
                case 6:
                    ar[6]++;break;
                case 7:
                    ar[7]++;break;
                case 8:
                    ar[8]++;break;
                case 9:
                    ar[9]++;break;
            }
        }
        for(int i = 0; i < 10;i++){
            logger.info("Count for "+i+" is "+ar[i]);
        }
    }
}
